//
//  DispatchQueue+Ext.swift
//  CocoProject
//
//  Created by Vill on 2023/11/7.
//

import Foundation

extension DispatchQueue {
    
    /// 主线程安全的异步派发
    func safeAsync(_ block: @escaping ()->()) {
        if self === DispatchQueue.main && Thread.isMainThread {
            block()
        } else {
            async { block() }
        }
    }
    
}

